package com.example.coursehub.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

@Getter
@Setter
@Entity
@Table(name = "wrong_question_bank", schema = "courseHub")
public class WrongQuestionBank {
    @Id
    @Column(name = "wrong_question_bank_id", nullable = false, length = 100)
    private String wrongQuestionBankId;

    @ManyToOne(fetch = FetchType.EAGER, optional = false)
    @JoinColumn(name = "user_id", nullable = false)
    private User user;

    @ManyToOne(fetch = FetchType.EAGER, optional = false)
    @OnDelete(action = OnDeleteAction.CASCADE)
    @JoinColumn(name = "course_id", nullable = false)
    private Course course;
    public WrongQuestionBank(String wrongQuestionBankId, User user, Course course) {
        this.wrongQuestionBankId = wrongQuestionBankId;
        this.user = user;
        this.course = course;
    }

    public WrongQuestionBank() {

    }

}